import { setStore, getStore } from '@/utils/store'

const user = {
  state: {
    permission: getStore({ name: 'permission' }) || {}
  },
  actions: {

  },
  mutations: {
    SET_PERMISSION: (state, permission) => {
      const result = permission.split(',')
      state.permission = {}
      result.forEach(ele => {
        state.permission[ele] = true
      })
      setStore({ name: 'permission', content: state.permission, type: 'session' })
    }
  }

}
export default user
